package kr.board.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

import kr.board.domain.BoardCommand;

@Component
public class BoardDaoImpl extends SqlSessionDaoSupport implements BoardDao{


	@Override
	public BoardCommand selectBoard(Integer b_num) {
		BoardCommand command = (BoardCommand)getSqlSession().selectOne("selectBoard",b_num);
		System.out.println("b_num : " + b_num);
		return command;
	}
	
	@Override
	public void updateB_hits(Integer b_num) {
		getSqlSession().update("updateB_hits",b_num);
	}

	@Override
	public void update(BoardCommand board) {
		getSqlSession().update("updateBoard",board);
	}
 
	@Override
	public void delete(Integer b_num) {
		System.out.println("b_num Impl : " + b_num);
		getSqlSession().delete("deleteBoard",b_num);
	}

	@Override
	public List<BoardCommand> list(Map<String, Object> map) {
		List<BoardCommand> list = getSqlSession().selectList("selectBList",map);
		return list;
	}

	@Override
	public int getRowCount(Map<String, Object> map) {
		return getSqlSession().selectOne("selectBCount",map);
	} 

	@Override
	public void insert(BoardCommand board) {
		getSqlSession().insert("insertBoard",board);
	}
	@Override
	public List<BoardCommand> selectNotify() {
		List<BoardCommand> list = getSqlSession().selectList("selectNotify");
		return list;
	}

}
